package com.epfresh.bean;

import java.util.List;

public class StoreCategoryItem {
    private int quantity;
    private String name;
    private String id;
    private String storeId;
    private String type;
    private String businessTime;

    private double count;

    private boolean isSelect;

    private List<StoreCategoryItem> children;

    private int childPosition;


    public int getChildPosition() {
        return childPosition;
    }

    public void setChildPosition(int childPosition) {
        this.childPosition = childPosition;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<StoreCategoryItem> getChildren() {
        return children;
    }

    public void setChildren(List<StoreCategoryItem> children) {
        this.children = children;
    }

    public int getCount() {
        return (int)count;
    }

    public void setCount(double count) {
        this.count = count;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public int getQuantity() {
        return this.quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getStoreId() {
        return this.storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getBusinessTime() {
        if (businessTime!=null && !"".equals(businessTime)){
            return name +" 接单时间："+ businessTime;
        }
        return businessTime;
    }

    public void setBusinessTime(String businessTime) {
        this.businessTime = businessTime;
    }

    public String getSecondCategoryId() {
        if (id == null || "".equals(id) || type == null || "".equals(type)) {
            return null;
        }
        return id + "|" + type;
    }

    public void updateChildSelectItem() {
        if (children != null) {
            for (int i = 0; i < children.size(); i++) {
                StoreCategoryItem child = children.get(i);
                if (childPosition == i) {
                    child.setSelect(true);
                } else {
                    child.setSelect(false);
                }
            }
        }
    }

    @Override
    public String toString() {
        return "StoreCategoryItem{" +
                "quantity=" + quantity +
                ", name='" + name + '\'' +
                ", id='" + id + '\'' +
                ", storeId='" + storeId + '\'' +
                ", type='" + type + '\'' +
                ", count=" + count +
                ", isSelect=" + isSelect +
                ", children=" + children +
                '}';
    }
}
